#region License

// This file is part of Grawlix.
// 
// Grawlix is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
// Grawlix is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with Grawlix.  If not, see
// <http://www.gnu.org/licenses/>.

#endregion

using System.IO;
using System.Xml.XPath;

namespace Grawlix.Services.Resources
{
	/// <summary>
	/// Resolver for XML files.
	/// </summary>
	public class XmlResolver :
		TypedResolverBase<IXPathNavigable>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlResolver"/>
		/// class.
		/// </summary>
		/// <param name="resolver">The resolver which accesses
		/// resources.</param>
		public XmlResolver(IUriResolver resolver)
			: base(resolver)
		{
		}

		/// <summary>
		/// Parses the specified resource stream into the appropriate
		/// type.
		/// </summary>
		/// <param name="resourceStream">The resource stream to parse.</param>
		/// <returns>The created object.</returns>
		protected override IXPathNavigable Parse(
			Stream resourceStream)
		{
			return new XPathDocument(resourceStream);
		}
	}
}